<?php

/**
 * @author Tan-Tan
 * @package SeoPortal
 * @subpackage Server
 */
class AnalyzeUrlActivity extends Ezer_AsynchronousActivity
{
	public function execute(array $args)
	{
		$this->log("Executing Analyze URL Activity");
		
		$urlId = $args[Ezer_IntForeach::ITERATED_ITEM];
		$reportId = $args[CaseManager::VAR_REPORT_ID];
		
		$url = SeoUrlPeer::retrieveByPK($urlId);
		
		$issues = LogicManager::getIssues($url->getFullUrl());
		foreach($issues as $issue)
		{
			$issue->setUrlId($urlId);
			$issue->setReportId($reportId);
			$issue->save();
		}
			
		return true;
	}
}
